//https://leetcode.cn/problems/is-unique-lcci/
class Solution {
    public boolean isUnique(String astr) {
        //鸽巢原理
        if(astr.length() > 26) return false;
        //位图
        int bitMap = 0;
        for(int i = 0; i < astr.length(); i++) {
            int bit = astr.charAt(i) - 'a';
            int check = (bitMap >> bit);
            if((check & 1) == 1) return false;
            else bitMap |= (1 << bit);
        }
        return true;
    }
}